README For Uncommon and Bipartisan: Anti-Democratic Attitudes in the American Public

This repository contains all data and code necessary to replicate the findings in the paper. Materials are organized as follows:

- Code
	- Functions:
		- funcs_bvplot.R:	Function for demographics plot (fig 5+appendix materials)
		- funcs_theme.R: 	Creates ggplot theme object for plotting
	- Main:
		- gen_fig1.R: 		Pooled Norms/Violence Support
		- gen_fig2.R: 		Norms/Violence Support by Party + Over Time
		- gen_fig3.R: 		Violence Support by Party, Strength, and Affpol
		- gen_fig4.R: 		Perceived Norm/Violence Support by Party
		- gen_fig5.R: 		Loyalty Support by Salient Demographic Groups
		- gen_intext_age.R: 	Loyalty Support by Age
		- gen_intext_n.R: 	Survey/Panel N
		- gen_intext_pwr.R: 	Power Analysis
		- gen_tab1.R: 		Multilevel Regression
	- Supplementary:
		-gen_fig1s.R		Generates figure s1
		-gen_fig2s.R		Generates figure s2
		-gen_fig3s.R		Generates figure s3
		-gen_fig5s.R		Generates figure s5
		-gen_fig6s.R		Generates figure s6
		-gen_fig7s.R		Generates figure s7
		-gen_fig8s.R		Generates figure s8
		-gen_fig9s.R		Generates figure s9
		-gen_fig10s.R		Generates figure s10
		-gen_fig11s.R		Generates figure s11
		-gen_fig12s.R		Generates figure s12
		-gen_fig13s.R		Generates figure s13
		-gen_fig14s.R		Generates figure s14
		-gen_fig15s.R		Generates figure s15
		-gen_fig16s.R		Generates figure s16
		-gen_fig17s.R		Generates figure s17
		-gen_rf.R		Generates random forest objects
		-gen_tab2s.R		Generates tables s2, s3, and figure s4
		-gen_tab4s.R		Generates table s4
		-gen_tab5s.R		Generates tables s5 and s6
		-gen_tab8s.R		Generates tables s8 and s9
		-gen_tab10s.R		Generates tables s10 and s11
		-gen_tab12s.R		Generates tables s12 and s13
		-gen_tab14s.R		Generates table s14
		-gen_tab15s.R		Generates table s15
		-gen_tab16s.R		Generates table s16
		-gen_tab17s.R		Generates table s17
		-gen_tab18s.R		Generates table s18
		-gen_tab19s.R		Generates tables s19 and s20
		-gen_tab21s.R		Generates table s21
	- libraries.R: 			loads all necessary R packages for analysis
- Data
	- data_pnas.rds			Main survey data for all results
	- socialdesirability.rds	Survey wave for social desirability robustness check
	- deniers_wapo_all.rds		Auxiliary data for election deniers
	- gov_parties.csv		Auxiliary data for party of governor
- Output (intermediary objects created for more efficient computation)
	- data_split.rds		Training/testing split for random forest
	- randforest_demos_mods.rds	Trained/Fitted random forest models (demographics only)
	- randforest_demos_vip.rds	Variable importance for random forest models (demographics only)
	- randforest_mods.rds		Trained/Fitted random forest models (all predictors)
	- randforest_vip.rds		Variable importance for random forest models (all predictors)
- Plots
	- Main (all plots in main manuscript)
	- Supplementary (all plots in SI)
- Tables
	- Main (all tables in main manuscript)
	- Supplementary (all tables in SI, as .tex files)

The file "00_master.R" in the top directory can be run by itself to fully recreate all figures, tables, and in-text findings in both the main text and appendix. Please read step-by-step instructions within the file.